CREATE TABLE %%GLOBAL_tablePrefix%%CATEGORIES (
  categoryid NUMBER(11) NOT NULL ,
  name VARCHAR2(100)  DEFAULT '' ,
  description VARCHAR2(255)  DEFAULT '' ,
  parentid NUMBER(11) DEFAULT '0' NOT NULL,
  visits NUMBER(11) DEFAULT '0' NOT NULL,
  pass VARCHAR2(50) DEFAULT '',
  icon VARCHAR2(50)  DEFAULT '' ,
  security VARCHAR2(50) DEFAULT 'public' NOT NULL,
  approvaltype NUMBER(11) DEFAULT '0' NOT NULL,
  catorder NUMBER(11) DEFAULT '0' NOT NULL,
  CONSTRAINT %%GLOBAL_tablePrefix%%CATEGORIES_SECURITY_C CHECK (security IN ('public', 'private')),
  CONSTRAINT %%GLOBAL_tablePrefix%%CATEGORIES_PK PRIMARY KEY (categoryid)
)
 ; 

CREATE INDEX %%GLOBAL_tablePrefix%%CATEGORIES_I_PARENTID ON %%GLOBAL_tablePrefix%%CATEGORIES (parentid)
 ; 
CREATE INDEX %%GLOBAL_tablePrefix%%CATEGORIES_I_NAME ON %%GLOBAL_tablePrefix%%CATEGORIES (name)
 ; 

CREATE TABLE %%GLOBAL_tablePrefix%%CATEGORYASSOCIATIONS (
  categoryid NUMBER(11) DEFAULT '0' NOT NULL,
  questionid NUMBER(11) DEFAULT '0' NOT NULL,
  CONSTRAINT %%GLOBAL_tablePrefix%%CATEGORYASSOCIATIONS_PK PRIMARY KEY (categoryid, questionid)
)
 ; 

CREATE INDEX %%GLOBAL_tablePrefix%%CA_I_QCIDS ON %%GLOBAL_tablePrefix%%CATEGORYASSOCIATIONS (questionid, categoryid)
 ; 

CREATE TABLE %%GLOBAL_tablePrefix%%CATASSOC_HISTORY (
  categoryid NUMBER(11) DEFAULT '0' NOT NULL,
  questionid NUMBER(11) DEFAULT '0' NOT NULL,
  CONSTRAINT %%GLOBAL_tablePrefix%%CATASSOC_HISTORY_PK PRIMARY KEY (categoryid, questionid)
)
 ; 

CREATE INDEX %%GLOBAL_tablePrefix%%CAH_I_QCIDS ON %%GLOBAL_tablePrefix%%CATASSOC_HISTORY (questionid, categoryid)
 ; 

CREATE TABLE %%GLOBAL_tablePrefix%%COMMENTS (
  commentid NUMBER(11) NOT NULL ,
  questionid NUMBER(11) DEFAULT '0' NOT NULL,
  name VARCHAR2(100)  DEFAULT '' ,
  email VARCHAR2(250)  DEFAULT '' ,
  content CLOB,
  status VARCHAR2(50) DEFAULT 'pending' NOT NULL,
  posted DATE NOT NULL,
  CONSTRAINT %%GLOBAL_tablePrefix%%COMMENTS_STATUS_C CHECK (status IN ('pending','approved','disapproved')),
  CONSTRAINT %%GLOBAL_tablePrefix%%COMMENTS_PK PRIMARY KEY (commentid)
) 
 ; 

CREATE INDEX %%GLOBAL_tablePrefix%%COMMENTS_I_QID ON %%GLOBAL_tablePrefix%%COMMENTS (questionid)
 ; 
CREATE INDEX %%GLOBAL_tablePrefix%%COMMENTS_I_STATUS ON %%GLOBAL_tablePrefix%%COMMENTS (status)
 ; 

CREATE TABLE %%GLOBAL_tablePrefix%%GLOSSARY (
  glossaryid NUMBER(11) NOT NULL ,
  word VARCHAR2(100)  DEFAULT '' ,
  description LONG DEFAULT '',
  CONSTRAINT %%GLOBAL_tablePrefix%%GLOSSARY_PK PRIMARY KEY (glossaryid)
) 
 ; 

CREATE INDEX %%GLOBAL_tablePrefix%%GLOSSARY_I_WORD ON %%GLOBAL_tablePrefix%%GLOSSARY (word) 
 ; 

CREATE TABLE %%GLOBAL_tablePrefix%%GROUPS (
  groupid NUMBER(11) NOT NULL ,
  name VARCHAR2(50)  DEFAULT '' ,
  permissions VARCHAR2(4000) DEFAULT '',
  application VARCHAR2(4000) DEFAULT '',
  contactable NUMBER(1) NOT NULL,
  CONSTRAINT %%GLOBAL_tablePrefix%%GROUPS_PK PRIMARY KEY (groupid)
) 
 ; 
CREATE INDEX %%GLOBAL_tablePrefix%%GROUPS_I_NAME ON %%GLOBAL_tablePrefix%%GROUPS (name) 
 ; 

CREATE TABLE %%GLOBAL_tablePrefix%%MEMBERS (
  userid NUMBER(11) DEFAULT '0' NOT NULL,
  groupid NUMBER(11) DEFAULT '0' NOT NULL,
  CONSTRAINT %%GLOBAL_tablePrefix%%MEMBERS_PK PRIMARY KEY (userid, groupid)
) 
 ; 

CREATE TABLE %%GLOBAL_tablePrefix%%QUESTIONS (
  questionid NUMBER(11) NOT NULL ,
  title VARCHAR2(200)  DEFAULT '' ,
  answer CLOB,
  lastupdated DATE NOT NULL,
  related VARCHAR2(100)  DEFAULT '' ,
  visible NUMBER(1) DEFAULT '0' NOT NULL,
  sortorder NUMBER(11) DEFAULT '0' NOT NULL,
  userid NUMBER(11) DEFAULT '0' NOT NULL,
  views NUMBER(11) DEFAULT '0' NOT NULL,
  posvotes NUMBER(11) DEFAULT '0' NOT NULL,
  negvotes NUMBER(11) DEFAULT '0' NOT NULL,
  score NUMBER(11) DEFAULT '0' NOT NULL,
  emailed NUMBER(11) DEFAULT '0' NOT NULL,
  detectrelated NUMBER(1) DEFAULT '0' NOT NULL,
  metakeywords VARCHAR2(255) DEFAULT '',
  metadescription VARCHAR2(4000) DEFAULT '',
  startdate DATE NOT NULL,
  enableexpiry NUMBER(4) NOT NULL,
  expirydate DATE NOT NULL,
  featured NUMBER(1) DEFAULT '0' NOT NULL,
  workflowstatus VARCHAR2(50) DEFAULT 'auto_approved' NOT NULL,
  CONSTRAINT %%GLOBAL_tablePrefix%%QUESTIONS_WFS_C CHECK (workflowstatus IN ('auto_approved','approved','pending', 're_pending', 'disapproved')),
  CONSTRAINT %%GLOBAL_tablePrefix%%QUESTIONS_PK PRIMARY KEY (questionid)
) 
 ; 

CREATE INDEX %%GLOBAL_tablePrefix%%QUESTIONS_I_UID ON %%GLOBAL_tablePrefix%%QUESTIONS (userid) 
 ; 
CREATE INDEX %%GLOBAL_tablePrefix%%QUESTIONS_I_SCR ON %%GLOBAL_tablePrefix%%QUESTIONS (score) 
 ; 
CREATE INDEX %%GLOBAL_tablePrefix%%QUESTIONS_I_LUD ON %%GLOBAL_tablePrefix%%QUESTIONS (lastupdated) 
 ; 
CREATE INDEX %%GLOBAL_tablePrefix%%QUESTIONS_I_TS ON %%GLOBAL_tablePrefix%%QUESTIONS (title,sortorder) 
 ; 

CREATE INDEX %%GLOBAL_tablePrefix%%Q_FI_T ON %%GLOBAL_tablePrefix%%QUESTIONS(title) INDEXTYPE IS CTXSYS.CONTEXT 
 ; 
CREATE INDEX %%GLOBAL_tablePrefix%%Q_FI_A ON %%GLOBAL_tablePrefix%%QUESTIONS(answer) INDEXTYPE IS CTXSYS.CONTEXT 
 ; 
CREATE INDEX %%GLOBAL_tablePrefix%%Q_FI_M ON %%GLOBAL_tablePrefix%%QUESTIONS(metakeywords) INDEXTYPE IS CTXSYS.CONTEXT 
 ; 

CREATE TABLE %%GLOBAL_tablePrefix%%QUESTION_AUTH (
  questionauthid NUMBER(11) NOT NULL ,
  questionid NUMBER(11) NOT NULL,
  groupid NUMBER(11) NOT NULL,
  CONSTRAINT %%GLOBAL_tablePrefix%%QUESTION_UI_QGID UNIQUE (questionid,groupid),
  CONSTRAINT %%GLOBAL_tablePrefix%%QUESTION_AUTH_PK PRIMARY KEY (questionauthid)
) 
 ; 
CREATE INDEX %%GLOBAL_tablePrefix%%Q_I_GID ON %%GLOBAL_tablePrefix%%QUESTION_AUTH(groupid) 
 ; 

CREATE TABLE %%GLOBAL_tablePrefix%%QUESTIONS_HISTORY (
  versionid NUMBER(11) NOT NULL ,
  questionid NUMBER(11) NOT NULL ,
  title VARCHAR2(200)  DEFAULT '' ,
  answer CLOB,
  lastupdated DATE NOT NULL,
  related VARCHAR2(100)  DEFAULT '' ,
  visible NUMBER(1) DEFAULT '0' NOT NULL,
  sortorder NUMBER(11) DEFAULT '0' NOT NULL,
  userid NUMBER(11) DEFAULT '0' NOT NULL,
  views NUMBER(11) DEFAULT '0' NOT NULL,
  posvotes NUMBER(11) DEFAULT '0' NOT NULL,
  negvotes NUMBER(11) DEFAULT '0' NOT NULL,
  score NUMBER(11) DEFAULT '0' NOT NULL,
  emailed NUMBER(11) DEFAULT '0' NOT NULL,
  detectrelated NUMBER(1) DEFAULT '0' NOT NULL,
  metakeywords VARCHAR2(255) DEFAULT '',
  metadescription VARCHAR2(4000) DEFAULT '',
  startdate DATE NOT NULL,
  enableexpiry NUMBER(4) NOT NULL,
  expirydate DATE NOT NULL,
  featured NUMBER(1) DEFAULT '0' NOT NULL,
  workflowstatus VARCHAR2(50) DEFAULT 'auto_approved' NOT NULL,
  CONSTRAINT %%GLOBAL_tablePrefix%%QUESTIONSH_WFS_C CHECK (workflowstatus IN ('auto_approved','approved','pending', 're_pending', 'disapproved')),
  CONSTRAINT %%GLOBAL_tablePrefix%%QUESTIONSH_PK PRIMARY KEY (versionid)
) 
 ; 

CREATE INDEX %%GLOBAL_tablePrefix%%QUESTIONSH_I_QID ON %%GLOBAL_tablePrefix%%QUESTIONS_HISTORY (questionid) 
 ; 
CREATE INDEX %%GLOBAL_tablePrefix%%QUESTIONSH_I_LUD ON %%GLOBAL_tablePrefix%%QUESTIONS_HISTORY (lastupdated) 
 ; 

CREATE INDEX %%GLOBAL_tablePrefix%%QH_FI_T ON %%GLOBAL_tablePrefix%%QUESTIONS_HISTORY(title) INDEXTYPE IS CTXSYS.CONTEXT 
 ; 
CREATE INDEX %%GLOBAL_tablePrefix%%QH_FI_A ON %%GLOBAL_tablePrefix%%QUESTIONS_HISTORY(answer) INDEXTYPE IS CTXSYS.CONTEXT 
 ; 
CREATE INDEX %%GLOBAL_tablePrefix%%QH_FI_M ON %%GLOBAL_tablePrefix%%QUESTIONS_HISTORY(metakeywords) INDEXTYPE IS CTXSYS.CONTEXT 
 ; 

CREATE TABLE %%GLOBAL_tablePrefix%%RATINGS (
  rateid NUMBER(11) NOT NULL ,
  questionid NUMBER(11) DEFAULT '0' NOT NULL,
  ip VARCHAR2(50)  DEFAULT '' ,
  ratedat DATE NOT NULL,
  ratingemail VARCHAR2(60) DEFAULT '',
  ratingmessage VARCHAR2(250) DEFAULT '',
  CONSTRAINT %%GLOBAL_tablePrefix%%RATINGS_PK PRIMARY KEY (rateid)
) 
 ; 

CREATE TABLE %%GLOBAL_tablePrefix%%SEARCHHISTORY (
  searchstring VARCHAR2(255)  DEFAULT '' ,
  amount NUMBER(10) default '1' NOT NULL,
  numresults NUMBER(11) DEFAULT '0' NOT NULL,
  CONSTRAINT %%GLOBAL_tablePrefix%%SEARCHHISTORY_PK PRIMARY KEY (searchstring)
) 
 ; 

CREATE INDEX %%GLOBAL_tablePrefix%%QUESTIONSH_I_SNR ON %%GLOBAL_tablePrefix%%SEARCHHISTORY (numresults) 
 ; 

CREATE INDEX %%GLOBAL_tablePrefix%%SH_FI_N ON %%GLOBAL_tablePrefix%%SEARCHHISTORY(searchstring) INDEXTYPE IS CTXSYS.CONTEXT 
 ; 

CREATE TABLE %%GLOBAL_tablePrefix%%SUBMITTEDQUESTIONS (
  subquestid NUMBER(11) NOT NULL ,
  name VARCHAR2(100)  DEFAULT '' ,
  email VARCHAR2(250)  DEFAULT '' ,
  subject VARCHAR2(250)  DEFAULT '' ,
  message CLOB,
  posted DATE NOT NULL,
  CONSTRAINT %%GLOBAL_tablePrefix%%SUBMITTEDQUESTIONS_PK PRIMARY KEY (subquestid)
) 
 ; 

CREATE TABLE %%GLOBAL_tablePrefix%%SUBSCRIBERS (
  subscriberid NUMBER(11) NOT NULL ,
  questionid NUMBER(11) NOT NULL,
  email VARCHAR2(255) DEFAULT '',
  subscribedate DATE NOT NULL,
  confirmed NUMBER(1) NOT NULL,
  confirmcode VARCHAR2(32) NOT NULL,
  CONSTRAINT %%GLOBAL_tablePrefix%%SUBSCRIBERS_UI_QIDE UNIQUE (questionid,email),
  CONSTRAINT %%GLOBAL_tablePrefix%%SUBSCRIBERS_PK PRIMARY KEY (subscriberid)
) 
 ; 

CREATE INDEX %%GLOBAL_tablePrefix%%SUBSCRIBERS_I_QID ON %%GLOBAL_tablePrefix%%SUBSCRIBERS (questionid) 
 ; 
CREATE INDEX %%GLOBAL_tablePrefix%%SUBSCRIBERS_I_EC ON %%GLOBAL_tablePrefix%%SUBSCRIBERS (email,confirmcode) 
 ; 

CREATE TABLE %%GLOBAL_tablePrefix%%USERS (
  userid NUMBER(11) NOT NULL ,
  username VARCHAR2(50)  DEFAULT '' ,
  pass VARCHAR2(32)  DEFAULT '' ,
  firstname VARCHAR2(50)  DEFAULT '' ,
  lastname VARCHAR2(50)  DEFAULT '' ,
  status NUMBER(1) DEFAULT '0' NOT NULL,
  email VARCHAR2(255)  DEFAULT '' ,
  forgotpasscode VARCHAR2(32)  DEFAULT '' ,
  sessionid VARCHAR2(32)  DEFAULT '' ,
  tokencode VARCHAR2(128)  DEFAULT '' ,
  CONSTRAINT %%GLOBAL_tablePrefix%%USERS_UI_USRN UNIQUE (username),
  CONSTRAINT %%GLOBAL_tablePrefix%%USERS_PK PRIMARY KEY (userid)
) 
 ; 

CREATE INDEX %%GLOBAL_tablePrefix%%USERS_I_STA ON %%GLOBAL_tablePrefix%%USERS (status) 
 ; 

CREATE TABLE %%GLOBAL_tablePrefix%%CUSTOMFIELDS (
  customfieldid NUMBER(11) NOT NULL ,
  name VARCHAR2(100) DEFAULT '',
  type VARCHAR2(50) DEFAULT 'public' NOT NULL,
  CONSTRAINT %%GLOBAL_tablePrefix%%CUSTOMFIELDS_TYPE_C CHECK (type IN ('multi_check', 'freeform')),
  CONSTRAINT %%GLOBAL_tablePrefix%%CUSTOMFIELDS_PK PRIMARY KEY (customfieldid)
)
 ; 

CREATE TABLE %%GLOBAL_tablePrefix%%CUSTOMFIELDS_DATA (
  customfield_dataid NUMBER(11) NOT NULL ,
  customfieldid NUMBER(11) NOT NULL,
  data VARCHAR2(250) DEFAULT '',
  CONSTRAINT %%GLOBAL_tablePrefix%%CUSTOMFIELDS_DATA_PK PRIMARY KEY (customfield_dataid)
)
 ; 

CREATE INDEX %%GLOBAL_tablePrefix%%CUSTOMFIELDS_DATA_I_CID ON %%GLOBAL_tablePrefix%%CUSTOMFIELDS_DATA (customfieldid) 
 ; 


CREATE TABLE %%GLOBAL_tablePrefix%%QUESTIONS_CUSTOMFIELDS (
  questions_customfieldsid NUMBER(11) NOT NULL ,
  questionid NUMBER(11) NOT NULL,
  customfieldid NUMBER(11) NOT NULL,
  data VARCHAR2(250) DEFAULT '',
  CONSTRAINT %%GLOBAL_tablePrefix%%QC_PK PRIMARY KEY (questions_customfieldsid)
)
 ; 

CREATE INDEX %%GLOBAL_tablePrefix%%QC_I_QID ON %%GLOBAL_tablePrefix%%QUESTIONS_CUSTOMFIELDS (questionid) 
 ; 
CREATE INDEX %%GLOBAL_tablePrefix%%QC_I_CID ON %%GLOBAL_tablePrefix%%QUESTIONS_CUSTOMFIELDS (customfieldid) 
 ; 

CREATE TABLE %%GLOBAL_tablePrefix%%NEWSS (
  newsid NUMBER(11) NOT NULL ,
  title VARCHAR2(200)  DEFAULT '' ,
  content CLOB,
  lastupdated DATE NOT NULL,
  visible NUMBER(1) DEFAULT '0' NOT NULL,
  userid NUMBER(11) DEFAULT '0' NOT NULL,
  CONSTRAINT %%GLOBAL_tablePrefix%%NEWSS_PK PRIMARY KEY (newsid)
) 
 ; 

CREATE TABLE %%GLOBAL_tablePrefix%%PAGEINDEX (
    pageindexid NUMBER(11) NOT NULL ,
    fullurl VARCHAR2( 500 ) DEFAULT '' ,
    questionid NUMBER NOT NULL ,
    content CLOB,
    plugin VARCHAR2( 255 ) DEFAULT '' ,
    filename VARCHAR2( 255 ) DEFAULT '' ,
    lastupdated DATE NOT NULL ,
    CONSTRAINT %%GLOBAL_tablePrefix%%PAGEINDEX_UI_FU UNIQUE (fullurl),
    CONSTRAINT %%GLOBAL_tablePrefix%%PAGEINDEX_PK PRIMARY KEY (pageindexid)
) 
 ; 

CREATE TABLE %%GLOBAL_tablePrefix%%USERLOGIN (
    ipaddress VARCHAR2( 100 ) DEFAULT '' ,
    attemptnum NUMBER NOT NULL ,
    tslogin DATE NOT NULL ,
    CONSTRAINT %%GLOBAL_tablePrefix%%USERLOGIN_UI_IP UNIQUE (ipaddress)
) 
 ; 

CREATE INDEX %%GLOBAL_tablePrefix%%PAGEINDEX_I_LUD ON %%GLOBAL_tablePrefix%%PAGEINDEX (lastupdated) 
 ; 

CREATE INDEX %%GLOBAL_tablePrefix%%PI_FI_T ON %%GLOBAL_tablePrefix%%PAGEINDEX(content) INDEXTYPE IS CTXSYS.CONTEXT 
 ; 
CREATE INDEX %%GLOBAL_tablePrefix%%PI_FI_A ON %%GLOBAL_tablePrefix%%PAGEINDEX(filename) INDEXTYPE IS CTXSYS.CONTEXT 
 ; 


CREATE SEQUENCE %%GLOBAL_tablePrefix%%CATEGORIES_SEQ 
 ; 
CREATE OR REPLACE TRIGGER %%GLOBAL_tablePrefix%%CATEGORIES_TG BEFORE INSERT ON %%GLOBAL_tablePrefix%%CATEGORIES FOR EACH ROW WHEN (NEW.CATEGORYID IS NULL) BEGIN SELECT %%GLOBAL_tablePrefix%%CATEGORIES_SEQ.NEXTVAL INTO :NEW.CATEGORYID FROM DUAL __SEMI_COLUMN__ END __SEMI_COLUMN__ 
 ; 

CREATE SEQUENCE %%GLOBAL_tablePrefix%%COMMENTS_SEQ 
 ; 
CREATE OR REPLACE TRIGGER %%GLOBAL_tablePrefix%%COMMENTS_TG BEFORE INSERT ON %%GLOBAL_tablePrefix%%COMMENTS FOR EACH ROW WHEN (NEW.COMMENTID IS NULL) BEGIN SELECT %%GLOBAL_tablePrefix%%COMMENTS_SEQ.NEXTVAL INTO :NEW.COMMENTID FROM DUAL __SEMI_COLUMN__ END __SEMI_COLUMN__ 
 ; 

CREATE SEQUENCE %%GLOBAL_tablePrefix%%GLOSSARY_SEQ 
 ; 
CREATE OR REPLACE TRIGGER %%GLOBAL_tablePrefix%%GLOSSARY_TG BEFORE INSERT ON %%GLOBAL_tablePrefix%%GLOSSARY FOR EACH ROW WHEN (NEW.GLOSSARYID IS NULL) BEGIN SELECT %%GLOBAL_tablePrefix%%GLOSSARY_SEQ.NEXTVAL INTO :NEW.GLOSSARYID FROM DUAL __SEMI_COLUMN__ END __SEMI_COLUMN__ 
 ; 

CREATE SEQUENCE %%GLOBAL_tablePrefix%%GROUPS_SEQ 
 ; 
CREATE OR REPLACE TRIGGER %%GLOBAL_tablePrefix%%GROUPS_TG BEFORE INSERT ON %%GLOBAL_tablePrefix%%GROUPS FOR EACH ROW WHEN (NEW.GROUPID IS NULL) BEGIN SELECT %%GLOBAL_tablePrefix%%GROUPS_SEQ.NEXTVAL INTO :NEW.GROUPID FROM DUAL __SEMI_COLUMN__ END __SEMI_COLUMN__ 
 ; 

CREATE SEQUENCE %%GLOBAL_tablePrefix%%QUESTIONS_SEQ 
 ; 
CREATE OR REPLACE TRIGGER %%GLOBAL_tablePrefix%%QUESTIONS_TG BEFORE INSERT ON %%GLOBAL_tablePrefix%%QUESTIONS FOR EACH ROW WHEN (NEW.QUESTIONID IS NULL) BEGIN SELECT %%GLOBAL_tablePrefix%%QUESTIONS_SEQ.NEXTVAL INTO :NEW.QUESTIONID FROM DUAL __SEMI_COLUMN__ END __SEMI_COLUMN__ 
 ; 

CREATE SEQUENCE %%GLOBAL_tablePrefix%%QUESTION_AUTH_SEQ 
 ; 
CREATE OR REPLACE TRIGGER %%GLOBAL_tablePrefix%%QUESTION_AUTH_TG BEFORE INSERT ON %%GLOBAL_tablePrefix%%QUESTION_AUTH FOR EACH ROW WHEN (NEW.QUESTIONAUTHID IS NULL) BEGIN SELECT %%GLOBAL_tablePrefix%%QUESTION_AUTH_SEQ.NEXTVAL INTO :NEW.QUESTIONAUTHID FROM DUAL __SEMI_COLUMN__ END __SEMI_COLUMN__ 
 ; 

CREATE SEQUENCE %%GLOBAL_tablePrefix%%QUESTIONS_HISTORY_SEQ 
 ; 
CREATE OR REPLACE TRIGGER %%GLOBAL_tablePrefix%%QH_TG BEFORE INSERT ON %%GLOBAL_tablePrefix%%QUESTIONS_HISTORY FOR EACH ROW WHEN (NEW.VERSIONID IS NULL) BEGIN SELECT %%GLOBAL_tablePrefix%%QUESTIONS_HISTORY_SEQ.NEXTVAL INTO :NEW.VERSIONID FROM DUAL __SEMI_COLUMN__ END __SEMI_COLUMN__ 
 ; 

CREATE SEQUENCE %%GLOBAL_tablePrefix%%RATINGS_SEQ 
 ; 
CREATE OR REPLACE TRIGGER %%GLOBAL_tablePrefix%%RATINGS_TG BEFORE INSERT ON %%GLOBAL_tablePrefix%%RATINGS FOR EACH ROW WHEN (NEW.RATEID IS NULL) BEGIN SELECT %%GLOBAL_tablePrefix%%RATINGS_SEQ.NEXTVAL INTO :NEW.RATEID FROM DUAL __SEMI_COLUMN__ END __SEMI_COLUMN__ 
 ; 

CREATE SEQUENCE %%GLOBAL_tablePrefix%%SUBMITTEDQUESTIONS_SEQ 
 ; 
CREATE OR REPLACE TRIGGER %%GLOBAL_tablePrefix%%SUBMITTEDQUESTIONS_TG BEFORE INSERT ON %%GLOBAL_tablePrefix%%SUBMITTEDQUESTIONS FOR EACH ROW WHEN (NEW.SUBQUESTID IS NULL) BEGIN SELECT %%GLOBAL_tablePrefix%%SUBMITTEDQUESTIONS_SEQ.NEXTVAL INTO :NEW.SUBQUESTID FROM DUAL __SEMI_COLUMN__ END __SEMI_COLUMN__ 
 ; 

CREATE SEQUENCE %%GLOBAL_tablePrefix%%SUBSCRIBERS_SEQ 
 ; 
CREATE OR REPLACE TRIGGER %%GLOBAL_tablePrefix%%SUBSCRIBERS_TG BEFORE INSERT ON %%GLOBAL_tablePrefix%%SUBSCRIBERS FOR EACH ROW WHEN (NEW.SUBSCRIBERID IS NULL) BEGIN SELECT %%GLOBAL_tablePrefix%%SUBSCRIBERS_SEQ.NEXTVAL INTO :NEW.SUBSCRIBERID FROM DUAL __SEMI_COLUMN__ END __SEMI_COLUMN__ 
 ; 

CREATE SEQUENCE %%GLOBAL_tablePrefix%%USERS_SEQ 
 ; 
CREATE OR REPLACE TRIGGER %%GLOBAL_tablePrefix%%USERS_TG BEFORE INSERT ON %%GLOBAL_tablePrefix%%USERS FOR EACH ROW WHEN (NEW.USERID IS NULL) BEGIN SELECT %%GLOBAL_tablePrefix%%USERS_SEQ.NEXTVAL INTO :NEW.USERID FROM DUAL __SEMI_COLUMN__ END __SEMI_COLUMN__ 
 ; 

CREATE SEQUENCE %%GLOBAL_tablePrefix%%CUSTOMFIELDS_SEQ 
 ; 
CREATE OR REPLACE TRIGGER %%GLOBAL_tablePrefix%%CUSTOMFIELDS_TG BEFORE INSERT ON %%GLOBAL_tablePrefix%%CUSTOMFIELDS FOR EACH ROW WHEN (NEW.CUSTOMFIELDID IS NULL) BEGIN SELECT %%GLOBAL_tablePrefix%%CUSTOMFIELDS_SEQ.NEXTVAL INTO :NEW.CUSTOMFIELDID FROM DUAL __SEMI_COLUMN__ END __SEMI_COLUMN__ 
 ; 

CREATE SEQUENCE %%GLOBAL_tablePrefix%%CUSTOMFIELDS_DATA_SEQ 
 ; 
CREATE OR REPLACE TRIGGER %%GLOBAL_tablePrefix%%CUSTOMFIELDS_DATA_TG BEFORE INSERT ON %%GLOBAL_tablePrefix%%CUSTOMFIELDS_DATA FOR EACH ROW WHEN (NEW.CUSTOMFIELD_DATAID IS NULL) BEGIN SELECT %%GLOBAL_tablePrefix%%CUSTOMFIELDS_DATA_SEQ.NEXTVAL INTO :NEW.CUSTOMFIELD_DATAID FROM DUAL __SEMI_COLUMN__ END __SEMI_COLUMN__ 
 ; 

CREATE SEQUENCE %%GLOBAL_tablePrefix%%QUESTIONS_CUSTOMFIE_SEQ 
 ; 
CREATE OR REPLACE TRIGGER %%GLOBAL_tablePrefix%%QUESTIONS_CUSTOMFIE_TG BEFORE INSERT ON %%GLOBAL_tablePrefix%%QUESTIONS_CUSTOMFIELDS FOR EACH ROW WHEN (NEW.QUESTIONS_CUSTOMFIELDSID IS NULL) BEGIN SELECT %%GLOBAL_tablePrefix%%QUESTIONS_CUSTOMFIE_SEQ.NEXTVAL INTO :NEW.QUESTIONS_CUSTOMFIELDSID FROM DUAL __SEMI_COLUMN__ END __SEMI_COLUMN__ 
 ; 

CREATE SEQUENCE %%GLOBAL_tablePrefix%%NEWSS_SEQ 
 ; 
CREATE OR REPLACE TRIGGER %%GLOBAL_tablePrefix%%NEWSS_TG BEFORE INSERT ON %%GLOBAL_tablePrefix%%NEWSS FOR EACH ROW WHEN (NEW.NEWSID IS NULL) BEGIN SELECT %%GLOBAL_tablePrefix%%NEWSS_SEQ.NEXTVAL INTO :NEW.NEWSID FROM DUAL __SEMI_COLUMN__ END __SEMI_COLUMN__ 
 ; 

CREATE SEQUENCE %%GLOBAL_tablePrefix%%PAGEINDEX_SEQ 
 ; 
CREATE OR REPLACE TRIGGER %%GLOBAL_tablePrefix%%PAGEINDEX_TG BEFORE INSERT ON %%GLOBAL_tablePrefix%%PAGEINDEX FOR EACH ROW WHEN (NEW.PAGEINDEXID IS NULL) BEGIN SELECT %%GLOBAL_tablePrefix%%PAGEINDEX_SEQ.NEXTVAL INTO :NEW.PAGEINDEXID FROM DUAL __SEMI_COLUMN__ END __SEMI_COLUMN__ 
 ; 
